/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Eph
 */
@Entity
@Table(name = "transaction_list", catalog = "starter", schema = "")
@NamedQueries({
    @NamedQuery(name = "TransactionList.findAll", query = "SELECT t FROM TransactionList t"),
    @NamedQuery(name = "TransactionList.findByTransactionID", query = "SELECT t FROM TransactionList t WHERE t.transactionID = :transactionID"),
    @NamedQuery(name = "TransactionList.findByTransactionDate", query = "SELECT t FROM TransactionList t WHERE t.transactionDate = :transactionDate"),
    @NamedQuery(name = "TransactionList.findByTransactionCost", query = "SELECT t FROM TransactionList t WHERE t.transactionCost = :transactionCost")})
public class TransactionList implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TransactionID")
    private Integer transactionID;
    @Column(name = "TransactionDate")
    @Temporal(TemporalType.DATE)
    private Date transactionDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "TransactionCost")
    private Float transactionCost;

    public TransactionList() {
    }

    public TransactionList(Integer transactionID) {
        this.transactionID = transactionID;
    }

    public Integer getTransactionID() {
        return transactionID;
    }

    public void setTransactionID(Integer transactionID) {
        Integer oldTransactionID = this.transactionID;
        this.transactionID = transactionID;
        changeSupport.firePropertyChange("transactionID", oldTransactionID, transactionID);
    }

    public Date getTransactionDate() {
        return transactionDate;
    }

    public void setTransactionDate(Date transactionDate) {
        Date oldTransactionDate = this.transactionDate;
        this.transactionDate = transactionDate;
        changeSupport.firePropertyChange("transactionDate", oldTransactionDate, transactionDate);
    }

    public Float getTransactionCost() {
        return transactionCost;
    }

    public void setTransactionCost(Float transactionCost) {
        Float oldTransactionCost = this.transactionCost;
        this.transactionCost = transactionCost;
        changeSupport.firePropertyChange("transactionCost", oldTransactionCost, transactionCost);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transactionID != null ? transactionID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransactionList)) {
            return false;
        }
        TransactionList other = (TransactionList) object;
        if ((this.transactionID == null && other.transactionID != null) || (this.transactionID != null && !this.transactionID.equals(other.transactionID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "javaapplication1.TransactionList[ transactionID=" + transactionID + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
